﻿using MediatR;
using T.Personnel.API.Application.Command.RegisterCommand;
using T.Personnel.Repository.Interface;

namespace T.Personnel.API.Application.CommandHandler.RegisterHandler
{
    public class DelRegisterHandler : IRequestHandler<DelRegisterCommand, int>
    {
        private readonly IRegisterRepository registerRepository;

        public DelRegisterHandler(IRegisterRepository registerRepository)
        {
            this.registerRepository = registerRepository;
        }

        public async Task<int> Handle(DelRegisterCommand request, CancellationToken cancellationToken)
        {
            return await registerRepository.DelRegisterAsync(request.id, request.name);
        }
    }
}
